import { ref } from 'vue'
import { defineStore } from 'pinia'

/**
 * @author Elliot
 * @date 2023-04-18 17:53
 * @description 遮罩数据管理
 */
export const useOverlayStore = defineStore('overlay', () => {
	const isShow = ref(false); // 是否显示遮罩层
    const closeOnClickOverlay = ref(true); // 点击遮罩层是否关闭弹窗
    
	// 设置是否显示遮罩
	function setShow (show = true) {
		isShow.value = show;
	}

	// 设置点击遮罩层是否关闭弹窗
    function setCloseOnClickOverlay (is = false) {
        closeOnClickOverlay.value = is;
    }

	return { isShow, setShow, closeOnClickOverlay, setCloseOnClickOverlay }
});